home *** CD-ROM | disk | FTP | other *** search
/ Medabots Cardz / Medabots CD Cardz Metabee.bin / pc / assets / metabee.dxr / 00008_Script_8 < prev    next >
Text File  |  2001-12-07  |  2KB  |  65 lines

  1. property pSpeed, dx, dy
  2. property mysprite
  3. global discx, discy, area, smallmedal, portdy, portdx, goback
  4.  
  5. on beginsprite me
  6.   set mysprite to the spritenum of me
  7.   set the blend of sprite mysprite = 100
  8.   set dx to the loch of sprite(mysprite)
  9.   set dy to the locv of sprite(mysprite)
  10. end
  11.  
  12. on mouseUp me
  13.   if sprite mysprite intersects sprite(11) then
  14.     set the blend of sprite mysprite = 0
  15.     set the loch of sprite mysprite to dx
  16.     set the locv of sprite mysprite to dy
  17.     smallmedal = 1
  18.     area = 1
  19.   else
  20.     set the loch of sprite mysprite to dx
  21.     set the locv of sprite mysprite to dy
  22.   end if 
  23. end
  24.  
  25. on exitframe
  26.     if area = 0 then
  27.     sprite(mysprite).moveablesprite = TRUE
  28.   else
  29.     sprite(mysprite).moveablesprite = FALSE
  30.   end if
  31.   
  32.   if goback = 1 then
  33.     set the blend of sprite mysprite = 100
  34.     goback = 0
  35.   end if
  36.   
  37.   if sprite mysprite intersects sprite(11) then
  38. --    set the width of sprite(mysprite) to 38
  39. --    set the height of sprite(mysprite) to 40
  40.   else 
  41. --    set the width of sprite(mysprite) to 66
  42. --    set the height of sprite(mysprite) to 77
  43.   end if
  44. end
  45.  
  46.  
  47. -- move character
  48. on move me, dx, dy
  49.   -- get current loc
  50.   loc = sprite(me.spriteNum).loc
  51.   
  52.   -- move loc and rect
  53.   global pSpeed
  54.   loc = loc + point(dx,dy)*pSpeed
  55.   rect = rect + rect(dx*pSpeed,dy*pSpeed,dx*pSpeed,dy*pSpeed)
  56.   
  57.   -- safety check to make sure character stays on screen
  58.   if rect.left < 0 then exit
  59.   if rect.top < 0 then exit
  60.   if rect.right > (the stage).rect.width then exit
  61.   if rect.bottom > (the stage).rect.height then exit
  62.   
  63.   -- set new character location
  64.   sprite(me.spriteNum).loc = loc
  65. end